#include <iostream>
#include <string>

#include "singleton.h"
using namespace std;


class test
{
    //使Sngleton可以放问test类的构造函数
    friend class Sngleton<test>;
public:
    void show() { cout << "test" << endl; }

private:
    //防止用户实例化多个test类
    test() {}
    test(const test&) {}
    ~test() {}
    test& operator=(const test)=delete;
};

int main(void)
{
    //在主线程中提前构造test,保证线程安全
    Sngleton<test>::GetInstance();

    Sngleton<test>::GetInstance()->show();
    return 0;
}
